﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Main.lib.graphics
{

    /*
     * DisplayObject
     * 
     * @brief   Base class for all drawable components
     * @version 2011.11.14
     * 
     * @author  Bruno Miguel de Oliveira Tamer <bmotamer@gmail.com>
     */
    public abstract class DisplayObject
    {
        
     // Scope  Type                Name         Value
        public bool                Invisible  = false;              //!< Invisibility
        public Vector2             Position   = Vector2.Zero;       //!< Position where the object will be drawn
        public Nullable<Rectangle> Rectangle  = null;               //!< Rectangle of crop (null for no crop)
        public Color               Color      = Color.White;        //!< Color mask
        public Single              Rotation   = 0.0f;               //!< Angle
        public Vector2             Origin     = Vector2.Zero;       //!< Pivot point
        public Vector2             Scale      = Vector2.One;        //!< Zoom
        public SpriteEffects       Effects    = SpriteEffects.None; //!< Effects
        public Single              LayerDepth = 0.0f;               //!< Drawing's order indicator

        /*
         * Constructor
         * 
         * @brief Add itself to the screen
         */
        public DisplayObject()
        {
            Graphics.Add(this);
        }

        /*
         * Draw the object on the screen
         * 
         * @warning This method is called automatically
         * @param   (SpriteBatch) SpriteBatch - Context which the image will be drawn
         */
        public abstract void Draw(SpriteBatch SpriteBatch);

        /*
         * Remove itself from the screen
         */
        public virtual void Dispose()
        {
            Graphics.Remove(this);
        }

    }

}